//
//  AIFDeleteCacheManager.m
//  PywSdk
//
//  Created by Jade on 16/9/12.
//  Copyright © 2016年 zero. All rights reserved.
//

#import "AIFDeleteCacheManager.h"

@implementation AIFDeleteCacheManager

NSString *const DeleteCache_TID = @"tid";
NSString *const DeleteCache_USERNAME = @"username";
NSString *const DeleteCache_SIGN = @"sign";
NSString *const DeleteCache_GAMEKEY = @"gamekey";
NSString *const DeleteCache_GAMEID = @"gameid";

- (instancetype)init
{
    self = [super init];
    if (self) {
        self.child = self;
        self.paramSource = self;
        self.validate = self;
    }
    return self;
}

#pragma mark - ETAPIManager
- (NSString *)methodName{
    return URL_DELETECACHE;
}

- (ETAPIManagerRequestType)requestType{
    return ETAPIManagerRequestTypePost;
}


- (NSString *)seriviceType{
    return [PywAppInfo sharedAppInfo].seriviceType;
}

#pragma mark - ETAPIManagerParamSourceDelegate

- (NSDictionary *)paramsForApi:(ETApiBaseManager *)manager{
    
    //流水号
    NSString *gameid = [PywAppInfo sharedAppInfo].gameId;
    NSString *username = self.username;
    NSString *tid = [[PywAppInfo sharedAppInfo] tid];
    NSString *gamekey = [[PywAppInfo sharedAppInfo] gameKey];
    
    NSString *apiSecret2 = [AppUtil getApiSecret2:tid apiSecret:[PywAppInfo sharedAppInfo].apisecret];
    
    NSString *sign = [NSString stringWithFormat:@"%@%@",username,apiSecret2];
    sign = [PywCipherUtils md5:sign];
    
    
    MutableDictionary *param = [[MutableDictionary alloc] init];
    [param setObject:tid forKey:DeleteCache_TID];
    [param setObject:gameid forKey:DeleteCache_GAMEID];
    [param setObject:gamekey forKey:DeleteCache_GAMEKEY];
    [param setObject:sign forKey:DeleteCache_SIGN];
    [param setObject:username forKey:DeleteCache_USERNAME];
    return param;
}

#pragma mark - ETAPIManagerValidator
- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithParamsData:(NSDictionary *)data{
    return YES;
}

- (BOOL)manager:(ETApiBaseManager *)manager isCorrectWithCallBackData:(NSDictionary *)data{
    return YES;
}
@end
